import { defineConfig } from "vitepress";
import topNav from "./topNav/index.js";
import { vitePressNote } from "./sideBar/vitePressBar.js";
import mdItCustomAttrs from "markdown-it-custom-attrs";

// https://vitepress.dev/reference/site-config
export default defineConfig({
  // base: "/vitepress/", // 设置github部署的路径，解决css样式失效问题

  title: "君软文档", //标题

  description: "备忘录文档", //说明

  // srcDir:'docs', // 指定新的【源目录】是 docs

  outDir: "./dist", // 打包目录

  lastUpdated: true, // string | boolean    // 获取每个文件最后一次 git 提交的 UNIX 时间戳(ms)，同时它将以合适的日期格式显示在每一页的底部

  head: [
    // 添加图标
    ["link", { rel: "icon", href: "/favicon.ico" }],
    [
      "script",
      {
        src: "https://cdn.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.umd.js",
      },
    ],
  ],

  themeConfig: {
    // https://vitepress.dev/reference/default-theme-config

    logo: "/public/知识库.svg", // 导航上的logo
    siteTitle: "君软开发文档", // false(隐藏logo右边的标题)
    nav: topNav, // 头部导航栏配置

    search: {
      //本地搜索
      provider: "local",
    },
    //返回顶部文字修改
    returnToTopLabel: "返回顶部",
    // 禁用死链接检查
    // ignoreDeadLinks: true,

    sidebar: {
      // 左侧导航栏
      "/note/vitePress": vitePressNote,
    },

    // 站点页脚配置
    footer: {
      message: "君软开发文档",
      copyright: "Copyright © 2024-present Echo",
    },

    outlineTitle: "本页目录", // 右侧边栏配置，默认值是"On this page"
    lastUpdatedText: "最后更新", // string

    // 设置社交链接
    // socialLinks: [
    //   { icon: 'github', link: 'https://gitee.com/yanjing_404' }
    // ]
    markdown: {
      config: (md) => {
        // use more markdown-it plugins!
        md.use(mdItCustomAttrs, "image", {
          "data-fancybox": "gallery",
        });
      },
    },
  },
});
